<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.ccxe.manage.page.PagerList" %>
<%@ page import="com.ccxe.manage.page.Pager" %>
<%@ page import="com.ccxe.manage.bo.OperatorPassword" %>
<jsp:useBean id="pagi" class="com.ccxe.manage.service.page.bean.PageBean" scope="request"></jsp:useBean>

<%

    String userId=(String)request.getAttribute("userId");//登录用户id
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";

	List operatorList=null;
	String str = String.valueOf(request.getAttribute("totalSize")) ;
	str = (str==null||"".equals(str)||"null".equals(str))?"0":str ;
	int totalSize=Integer.parseInt(str);
	
	PagerList pagerList=(PagerList)request.getAttribute("pagerList");
	Pager pager=null;
	if(pagerList!=null){
	   pager=pagerList.getPager();
	   operatorList=pagerList.getList();
	}
	if(operatorList==null){
	   operatorList=new ArrayList();
	}
	
	int pageTotal=totalSize/pager.getPageSize();
	if(pageTotal*(pager.getPageSize())<totalSize){
	  pageTotal++;
	}
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>"/>
<title>管理员列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link id="rightCss" rel="stylesheet" type="text/css" href="<%=basePath %>css/right.css" />

<script type="text/javascript" src="<%=basePath %>js/base.js"></script>

<script type="text/javascript">
function modifyPassword(operatorId){
   document.myform.action = 'servlet/passwordServlet?method=modify&operatorId='+operatorId;
   document.myform.submit();
}
function deletePassword(operatorId){
var userIdLogin='<%=userId%>';
if(operatorId==userIdLogin){
  alert("不可以删除当前登录用户");
}else{
  if(confirm("确定要删除吗？")){
    document.myform.action = 'servlet/passwordServlet?method=delete&operatorId='+operatorId;
    document.myform.submit();
  }
}
}

function go2Page(){
      var temp00=document.getElementById("currentPage").value;
      document.myform.action = 'servlet/passwordServlet?method=go2Page';
      document.myform.submit();
}

function go2Page2(currentPage){
      document.myform.action = 'servlet/passwordServlet?method=go2Page&currentPage='+currentPage;
      document.myform.submit();
}
</script>
</head>
<body>
<div class="crumbs">当前位置：首页 &gt; 管理员列表</div>
<div class="search">
	<div class="tab">
		<span class="right"></span>
		<span class="font-blue14pxb">管理员列表</span>
	</div>
</div>

<form name="myform" id="myform" action="servlet/passwordServlet" method="post">
<div class="tableBox">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
 <th width="5%">序号</th>
 <th width="15%">用户ID</th>
 <th width="15%">姓名</th>
 <th width="20%">最近更改时间</th>
 <th width="20%">操作</th>
 </tr>
 <%
 int temp=pager.getStartNum();
 for(int i=0;i<operatorList.size();i++){
      OperatorPassword operatorPassword=(OperatorPassword)operatorList.get(i);
      temp++;
 %>
 <tr>
 <th class="h"><%=temp%></th>
 <td><%=operatorPassword.getOperatorId()%></td>
 <td><%=operatorPassword.getOperatorName()%></td>
 <td><%=operatorPassword.getPwdChangeDate()%></td>
 <td>
 <img src="/CCXIM/images/icon/list_edit.gif" /><input type="button" name="button1" value="修改" onclick="modifyPassword('<%=operatorPassword.getOperatorId()%>')" class="button"/>&nbsp;&nbsp; 
 <img src="/CCXIM/images/icon/list_del.gif" /><input type="button" name="button1" value="删除" onclick="deletePassword('<%=operatorPassword.getOperatorId()%>')" class="button"/>&nbsp;&nbsp; 
 </td>
 </tr>
 <% }%>
 </table>
 </div>
 
 
  <div class="paging">
		<div class="page">
			<% 
			int currentPage=pager.getCurrentPage();
				if("1".equals(currentPage+"")){
			%>
					<a class="none">&#124;&#65308;最前页</a>
					<a class="none">&lt;&lt;上一页</a>
			<%}else{%>
					<a onclick="go2Page2('1')">&lt;&lt;最前页</a>
					<a onclick="go2Page2('<%=pager.getCurrentPage()-1%>')">&lt;&lt;上一页</a>			
			<%}%>
			<%if(pager.getCurrentPage()<(pageTotal)){%>
					<a  onclick="go2Page2('<%=pager.getCurrentPage()+1%>')">下一页 &#62;&#62;</a>
					<a onclick="go2Page2('<%=pageTotal%>')">最末页 &#62;&#124;</a>
			<%}else{%>
			        <a class="none">&#124;&#65308;最前页</a>
					<a class="none">&lt;&lt;上一页</a>
			<%} %>
		</div>
		共<span><%=totalSize%></span>条数据    共<span><%=pageTotal%></span>页 &nbsp;
		跳转到第	<select name="currentPage" onchange="javascript:go2Page();" style="width:50px;">
			<%
				for(int i =1;i<=pageTotal;i++)
				{
					if(i == pager.getCurrentPage()){
					%>
						<option selected><%=i%></option>
					<%
					}else{
					%>
						<option ><%=i %></option>
					<%
					}
				}
			%>
		</select>页
	</div> 
 
</form>
</body>
</html>
